unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, ADODB, StdCtrls, cxGraphics, cxControls, cxLookAndFeels,
  cxLookAndFeelPainters, dxSkinsCore, dxSkinsDefaultPainters, cxSSheet;

type
  TForm1 = class(TForm)
    ADOConnection1: TADOConnection;
    Btnx_1: TButton;
    Btnx_2: TButton;
    Btnx_3: TButton;
    CxExcel_1: TcxSpreadSheetBook;
    Btnx_4: TButton;
    procedure Btnx_1Click(Sender: TObject);
    procedure Btnx_2Click(Sender: TObject);
    procedure Btnx_3Click(Sender: TObject);
    procedure Btnx_4Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Btnx_1Click(Sender: TObject);
var
  SQLStr: string;
  Result: TADODataSet;
begin
  SQLSTR:= 'SELECT FIELD6,FIELD8,FIELD36,FIELD1,FIELD2,FIELD13,FIELD26, FIELD29,FIELD28,FIELD30,FIELD32 FROM TBL_WAGE_FL';
  //SQLSTR:='SELECT TOP 100 * FROM TBL_WAGE_FL A';
  try
    Result := TADODataSet.Create(ADOConnection1);
    try
      Result.Connection  := ADOConnection1;
      Result.CommandText := SQLStr;
      Result.Prepared := False;
      Result.Open;
    except
      On E: Exception do
      begin
        Result.Free;
        raise EADOError.Create(E.Message);
      end;
    end;
  finally

  end;

end;

procedure TForm1.Btnx_2Click(Sender: TObject);
{var
  SQLSTR:string;
  UniDataSet:TUniQuery;}
begin
  //SQLSTR:= 'SELECT A.FIELD1,A.FIELD2,A.FIELD6,A.FIELD8,A.FIELD36,A.FIELD13,A.FIELD26, A.FIELD29,A.FIELD28,A.FIELD30 FROM TBL_WAGE_FL A';
  {SQLSTR:='SELECT TOP 100 * FROM TBL_WAGE_FL A';
  try
    UniDataSet:=TUniEngine.GetDataSet(SQLSTR,UniConnection1);
    ShowMessageFmt('%D',[UniDataSet.RecordCount]);
  except
    On E: Exception do
    begin
      raise EADOError.Create(E.Message);
    end;
  end;}
end;

procedure TForm1.Btnx_3Click(Sender: TObject);
{var
  OD:TOpenDialog;}
begin
  {try
    OD:=TOpenDialog.Create(nil);
    OD.InitialDir:=ExtractFileDir(ParamStr(0));
    if OD.Execute then
    begin
      frxReport1.LoadFromFile(OD.FileName);
      frxReport1.DesignReport();
    end;
  finally
    FreeAndNil(OD);
  end;}
end;

procedure TForm1.Btnx_4Click(Sender: TObject);
var
  I,M:Integer;
  CellA:TcxSSCellObject;
begin
  with CxExcel_1 do
  begin
    for I := 0 to 20 do
    begin
      for M := 0 to ActiveSheet.ContentColCount - 1 do
      begin
        CellA:=ActiveSheet.GetCellObject(I,M);
        //CellA.Text;
        CellA.Free;
      end;
    end;
  end;
end;

end.
